/**
 * Copyright 2025 Beijing Volcano Engine Technology Co., Ltd. All Rights Reserved.
 * SPDX-license-identifier: BSD-3-Clause
 */

import ReactDOM from 'react-dom/client';
import { Provider } from 'react-redux';
import App from './App';
import store from './store';
import './index.less';
import { loadEnvVariables } from './utils/env';

// 初始化应用
const initApp = async () => {
  try {
    // 加载环境变量
    await loadEnvVariables();
    
    const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
    root.render(
      <Provider store={store}>
        <App />
      </Provider>
    );
  } catch (error) {
    console.error('应用初始化失败:', error);
  }
};

// 启动应用
initApp();
